home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / tcp_ip / tnos / tnos100s / ssaver.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-04-30  |  1.9 KB  |  108 lines

  1. #include <stdio.h>
  2. #include <conio.h>
  3. #include <dir.h>
  4. #include <dos.h>
  5. #include <io.h>
  6. #include "global.h"
  7. #include "session.h"
  8. #include "config.h"
  9.  
  10. extern unsigned char SCREENwidth, SCREENlength;
  11. #ifdef SCREENSAVER
  12. int32 LastIO, ScreenSaver;
  13. static int line, state, delayit, statline;
  14. int32 secclock ();
  15.  
  16. #ifdef TNOS_68K
  17. static WINDOW *saved;
  18. extern short UseCurses;
  19. extern chtype MY_NORMAL;
  20. #endif
  21.  
  22. #define DELAYVAL 2
  23.  
  24. void
  25. screensaver ()
  26. {
  27.     if (!ScreenSaver)
  28.         return;
  29. #ifdef TNOS_68K
  30.     if (!UseCurses)
  31.         return;
  32. #endif
  33.     if (secclock() > (LastIO + ScreenSaver))    {
  34.         if (!state)    {
  35.             statline = Current->screen->statline;
  36.             if (statline)
  37.                 statLineToggle ();
  38.             state = 1;
  39.             swapscreen (Current, NULLSESSION);
  40. #ifdef TNOS_68K
  41.             saved = newwin (24, 80, 0, 0);            
  42.             wattrset (saved, MY_NORMAL);
  43.             leaveok (saved, 1);
  44.             beep();
  45. #else
  46.             _setcursortype (_NOCURSOR);
  47. #endif
  48.             line = delayit = 0;
  49.         }
  50.         if (!delayit++)    {
  51. #ifndef TNOS_68K
  52.             setscreens (0, 7, 1);
  53.             gotoxy (12, ++line);
  54.             line %= SCREENlength;
  55.             printf (" TNOS Screen Saver Active... Press any key to continue ");
  56.             fflush (stdout);
  57. #else
  58.             werase (saved);
  59.             wmove (saved, line++, 12);
  60.             line %= SCREENlength;
  61.             waddstr (saved, " TNOS Screen Saver Active... Press any key to continue ");
  62.             wrefresh (saved);
  63. #endif
  64.         }
  65.         delayit %= DELAYVAL;
  66.     } else if (state)    {
  67. #ifdef TNOS_68K
  68.         delwin (saved);
  69. #endif
  70.         swapscreen (NULLSESSION, Current);
  71.         state = 0;
  72. #ifndef TNOS_68K
  73.         _setcursortype (_NORMALCURSOR);
  74. #endif
  75.         if (statline)
  76.             statLineToggle();
  77.     }
  78. }
  79.  
  80. /* set the screen saver value */
  81. int dossaver(argc, argv, p)
  82. int argc;
  83. char *argv[];
  84. void *p;
  85. {
  86.     LastIO = secclock();
  87.     return setlong(&ScreenSaver,"Screen Saver delay (seconds)",argc,argv);
  88.  
  89. }
  90. void
  91. sskick()
  92. {
  93.     if (ScreenSaver)    {
  94.         LastIO = secclock();
  95.         if (state)
  96.             screensaver();
  97.     }
  98. }
  99.  
  100. int
  101. ssenabled ()
  102. {
  103.     return state;
  104. }
  105.  
  106. #endif /* SCREENSAVER */
  107.  
  108.